package moredb;

import org.apache.commons.lang3.StringUtils;

/**
 * @author kongyz
 * @date 2018/6/17 10:21
 * @Description:
 */
public class ConnectionFactory {

    /**
     * 根据数据库类型，获取指定的链接
     * @param dbType
     * @return
     */
    public DatabaseConnection getConnection(String dbType){
        if(!StringUtils.isNotEmpty(dbType)){
            return null;
        }
        if(dbType.equalsIgnoreCase("mysql")){
            return new MysqlConnection();
        }else if(dbType.equalsIgnoreCase("mssql")){
            return new MSSqlConnection();
        }else if(dbType.equalsIgnoreCase("oracle")){
            return new OracleConnection();
        }
        return null;
    }
}
